import {action} from 'mobx'
// import * as service from './service'
import todoStore from './todo/actions'
import MainState from './state'

// 包含同步和异步的action
// 由于异步action有async前缀，所以同步异步的action很容易区分，所以没有对两种action分文件存放
export default class Actions {

    constructor(state) {
        this.state = new MainState()
    }
    @action.bound createTodo(title) {
        this.state.todos.push(new todoStore(title))
    }

    @action.bound removeTode(todo) {
        // remove不是原生的方法，是mobx提供的
        this.state.todos.remove(todo);
    }

}